package com.yonsz.open.platform.model;

import lombok.Data;

/**
 * @Description:
 * @Author: xiaojunnuo
 * @CreateDate: 2020/3/21 0021$
 */
@Data
public class OpenRequestPayload {

    private String deviceId;
    private Boolean withCmd;
    private String oper;
    private String value;
    private String houseId;
    private String modeId;

    public static OpenRequestPayload buildListPayload(String houseId, Boolean withCmd){
        OpenRequestPayload payload = new OpenRequestPayload();
        payload.houseId = houseId;
        payload.withCmd = withCmd;
        if(payload.withCmd == null){
            payload.withCmd = false;
        }
        return payload;
    }

    public static OpenRequestPayload buildControlPayload(String deviceId, String oper, String value){
        OpenRequestPayload payload = new OpenRequestPayload();
        payload.deviceId = deviceId;
        payload.oper = oper;
        payload.value = value;
        return payload;
    }

    public static OpenRequestPayload buildStatusPayload(String deviceId){
        OpenRequestPayload payload = new OpenRequestPayload();
        payload.deviceId = deviceId;
        return payload;
    }

    public static OpenRequestPayload buildModeListPayload(String houseId){
        OpenRequestPayload payload = new OpenRequestPayload();
        payload.houseId = houseId;
        return payload;
    }

    public static OpenRequestPayload buildModeControlPayload(String modeId, String houseId){
        OpenRequestPayload payload = new OpenRequestPayload();
        payload.modeId = modeId;
        payload.houseId = houseId;
        return payload;
    }
}
